<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实现calculate(2)(3)('+')=5</title>
</head>
<body>
    <!-- 
        需求：实现 calculate 功能函数

            举例说明：
            calculate(2)(3)('+')  // 5
            calculate(2)(3)('*')  // 6

     -->
</body>
<script>
    
    function calculate(n1){
        return function(n2){
            return function(symbol){
                if(symbol === '+') return n1 + n2
                if(symbol === '-') return n1 - n2
                if(symbol === '*') return n1 * n2
                if(symbol === '/') return n1 / n2
            }
        }
    }

    console.log(calculate(2)(3)('+'))
    console.log(calculate(2)(3)('*'))

</script>
</html>